import java.awt.Button;
import java.awt.CardLayout;
import java.awt.Frame;

public class CardLayoutTest {

	public static void main(String[] args) throws InterruptedException {
		Frame frm = new Frame("Frame with Controls");
		frm.setLayout(new CardLayout());

		Button[] btn = new Button[10];
		for (int i=0; i<10; i++)	{
			btn[i] = new Button("Button " + (i+1));
			frm.add(("Button " + (i+1)), btn[i]);
		}

		frm.setBounds(100, 100, 250, 100);
		frm.setVisible(true);
		while (true)	{
			Thread.sleep(1000);
			((CardLayout)frm.getLayout()).next(frm);
		}
	}
}
